home *** CD-ROM | disk | FTP | other *** search
- /*
- *
- * Handler to deal with double-clicks in DOpus for TwinExpress.
- *
- * (c) 1994 by K.P. van Beem (2:280/464.2, patrick.van.beem@aobh.xs4all.nl)
- *
- * Based on the DOpusLhaARexx package by Geoff Seeley (but you can better
- * use GuiArc in stead of DOpus and a script, to deal with archives)
- *
- * - Supports Drag / Dbl Click to copy or Enter Dirs
- * - Known Bug, First Dbl Click does a Enter Dir (Request not work ??)
- * The Program then works properly from then on ... !!
- *
- * - Added Directory caching...
- * - when this is called (on startup), makes a dir in temp for storage of directories
- */
-
- /* make the caching Dir*/
- /* address COMMAND "MakeDir >NIL: T:TwinDirs" */
-
- DOpusPort = 'DOPUS.1'
- TwinPort = 'TWIN.1'
-
- if ~show(l,"rexxsupport.library") then
- call addlib("rexxsupport.library",0,-30,0)
- if showlist('Ports', TwinPort) then do
- call ExitIt
- end
-
- options results
-
- /* open our message port */
- OurPort = openport(TwinPort)
- HandlerStatus = 'OPEN'
-
- do until HandlerStatus = 'CLOSE'
- call waitpkt(TwinPort)
- Packet = getpkt(TwinPort)
- if Packet ~= null() then do
- Cmd = getarg(Packet, 0)
- Directory = getarg(Packet, 2) /* entry text */
-
- call reply(Packet, 0)
-
- /*respond to a Double-Click*/
- if Cmd = '1' then do
- address value DOpusPort
- /* Get current directory */
- 'Status 6 -1'
- GetEntry Result
- FilePath = Result
- if left(FilePath,1) ~= '*' then
- TopText "You are not in a Twin directory !!"
- else do
- FilePath = SubStr(FilePath,2)
- /* Create new path and... */
- if right(FilePath,1) = ':' then
- FilePath = FilePath || Strip(left(Directory,25))
- else
- FilePath = FilePath || '/' || Strip(left(Directory,25))
- /* Check if entry is a directory */
-
- if words(FilePath) > 1 then
- Request "Spaces in a File / Directory Name are not Allowed !!"
- else
- if SubStr(Directory,26,9) ~= "Directory" then
- /*routine to type files...*/
- address COMMAND "rx Rexx:DOpus/TypeFile.rexx" FilePath
- else do
- /* ...command the actually entering of the directory */
- address COMMAND "rx Rexx:DOpus/ReadDir.rexx" FilePath
- end
- end
- end
-
- /*respond to a Click-m-Click*/
- if Cmd = '2' then do
- /* Check if entry is a directory */
- if SubStr(Directory,26,9) = "Directory" then do
- /* copy or Enter ? */
- Request "List Dir there [Okay] or Copy Dir there [Cancel] "
-
- if Result = 1 then do
-
- address value DOpusPort
- /* Get current directory */
- OtherWindow
- 'Status 6 -1'
- GetEntry Result
- FilePath = Result
- if left(FilePath,1) ~= '*' then
- TopText "You are not in a Twin directory !!"
- else do
- FilePath = SubStr(FilePath,2)
- /* Create new path and... */
- if right(FilePath,1) = ':' then
- FilePath = FilePath || Strip(left(Directory,25))
- else
- FilePath = FilePath || '/' || Strip(left(Directory,25))
-
- if words(FilePath) > 1 then
- Request "Spaces in a File / Directory Name are not Allowed !!"
- else do
- OtherWindow
- address COMMAND "rx Rexx:DOpus/ReadDir.rexx" FilePath
- end
- end
- end
- end
- else do
- /* copy the file, as it is not a Dir.*/
- OtherWindow
- address COMMAND "rx Rexx:DOpus/CopyFile.rexx WAIT"
- end
- end
-
- /*respond to the Stop Twin Handler REXX command and shut down Twin*/
- if Cmd = 'CLOSE' then do
- HandlerStatus = 'CLOSE'
- address command 'echo >PPipe: QUIT'
- /* address command 'C:Delete T:TwinDirs/#?' */
- /* address command 'C:Delete T:TwinDirs' */
- end
- end
- end
-
- /* close up shop */
- exitit:
- call closeport(OurPort)
-
- exit
-